//
//  NSMutableAttributedString+Extension.m
//  miku直播
//
//  Created by 杨尚达 on 2017/7/30.
//  Copyright © 2017年 杨尚达. All rights reserved.
//

#import "NSMutableAttributedString+Extension.h"


@implementation NSMutableAttributedString (Extension)

-(void)addImageWithImage:(UIImage*)image andFontSize:(CGFloat)fontSize{
    NSTextAttachment* attachment = [[NSTextAttachment alloc] init];
    attachment.image = image;
    attachment.bounds = CGRectMake(0, (fontSize - image.size.height) / 2, image.size.width, image.size.height);
    NSAttributedString *str = [NSAttributedString attributedStringWithAttachment:attachment];
    [self appendAttributedString:str];
}

@end
